home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / buildCameraToggleMenu.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  5.6 KB  |  152 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  31 April 1997
  22. //  Author:         cdt
  23. //
  24. //  Procedure Name:
  25. //      buildCameraToggleMenu
  26. //
  27. //  Description:
  28. //      Display of menu of toggles for the current camera.
  29. //
  30. //  Input Arguments:
  31. //      parent - menu name to build menu items for
  32. //      panel - name of panel this menu is associated with
  33. //
  34. //  Return Value:
  35. //      None.
  36. //
  37.  
  38. global proc buildCameraToggleMenu( string $parent, string $panel )
  39. {
  40.     setParent -m $parent;
  41.  
  42.     // If menu has not been created yet, create it now
  43.     //
  44.     if (`menu -q -numberOfItems $parent` == 0) {
  45.         menuItem -l "Perspective" -checkBox on cameraPerspItem;
  46.         menuItem -l "Journal"  -checkBox on cameraJournalItem;
  47.         menuItem -divider true;
  48.  
  49.         radioMenuItemCollection;
  50.         menuItem -l "No Gate" -radioButton on cameraNoGateItem;
  51.         menuItem -l "Film Gate" -radioButton off cameraFileGateItem;
  52.         menuItem -l "Resolution Gate" -radioButton off cameraResGateItem;
  53.         menuItem -divider true;
  54.  
  55.          menuItem -l "Field Chart" -checkBox on cameraFieldChartItem;
  56.         menuItem -l "Safe Action" -checkBox on cameraSafeActionItem;
  57.         menuItem -l "Safe Title" -checkBox on cameraSafeTitleItem;
  58.         menuItem -divider true;
  59.  
  60.         radioMenuItemCollection;
  61.          menuItem -l "Fill" -radioButton on cameraFillItem;
  62.         menuItem -l "Horizontal" -radioButton off cameraHorzItem;
  63.         menuItem -l "Vertical" -radioButton off cameraVertItem;
  64.          menuItem -l "Overscan" -radioButton off cameraOverscanItem;
  65.      }
  66.     
  67.     updateCameraToggleMenu ($parent, $panel);
  68. }
  69.  
  70. global proc updateCameraToggleMenu( string $parent, string $panel )
  71. {
  72.     
  73.     // Update the values in the menu based on the current camera
  74.     //
  75.     string $current = `modelPanel -q -camera $panel`;
  76.     int $isPerspective = !`camera -q -orthographic $current`;
  77.  
  78.     if ($isPerspective) {
  79.         menuItem -edit -checkBox true
  80.             -c ("camera -e -orthographic true "+$current+"; "+
  81.                 "updateCameraToggleMenu(\""+$parent+"\",\""+$panel+"\")") 
  82.             cameraPerspItem;
  83.     } else {
  84.         menuItem -edit -checkBox false
  85.             -c ("camera -e -orthographic false "+$current+"; "+
  86.                 "updateCameraToggleMenu(\""+$parent+"\",\""+$panel+"\")") 
  87.             cameraPerspItem;
  88.     }
  89.  
  90.     menuItem -edit -checkBox `camera -q -journalCommand $current`
  91.         -c ("camera -e -journalCommand #1 "+$current) cameraJournalItem;
  92.  
  93.     int $dfg = `camera -q -displayFilmGate $current`;
  94.     int $dr = `camera -q -displayResolution $current`;
  95.     menuItem -edit -radioButton (!$dfg && !$dr) -en $isPerspective
  96.         -c ("camera -e -displayFilmGate off -displayResolution off "+
  97.             "-overscan 1.0 "+$current) cameraNoGateItem;
  98.     menuItem -edit -radioButton $dfg -en $isPerspective
  99.         -c ("camera -e -displayFilmGate on -displayResolution off "+
  100.             "-overscan 1.3 "+$current) cameraFileGateItem;
  101.     menuItem -edit -radioButton $dr -en $isPerspective
  102.         -c ("camera -e -displayFilmGate off -displayResolution on "+
  103.             "-overscan 1.3 "+$current) cameraResGateItem;
  104.  
  105.     int $dfc = `camera -q -displayFieldChart $current`;
  106.     int $dsa = `camera -q -displaySafeAction $current`;
  107.     int $dst = `camera -q -displaySafeTitle $current`;
  108.     string $newState;
  109.  
  110.     if ($dfc == 1) {
  111.         $newState = "off ";
  112.     } else {
  113.         $newState = "on ";
  114.     }
  115.     menuItem -edit -checkBox $dfc -en $isPerspective
  116.         -c ("camera -e -displayFieldChart " + $newState + $current+"; "+
  117.             "updateCameraToggleMenu(\""+$parent+"\",\""+$panel+"\")") 
  118.         cameraFieldChartItem;
  119.     if ($dsa == 1) {
  120.         $newState = "off ";
  121.     } else {
  122.         $newState = "on ";
  123.     }
  124.     menuItem -edit -checkBox $dsa -en $isPerspective
  125.         -c ("camera -e -displaySafeAction " + $newState + $current+"; "+
  126.             "updateCameraToggleMenu(\""+$parent+"\",\""+$panel+"\")") 
  127.         cameraSafeActionItem;
  128.     if ($dst == 1) {
  129.         $newState = "off ";
  130.     } else {
  131.         $newState = "on ";
  132.     }
  133.     menuItem -edit -checkBox $dst -en $isPerspective
  134.         -c ("camera -e -displaySafeTitle " + $newState + $current+"; "+
  135.             "updateCameraToggleMenu(\""+$parent+"\",\""+$panel+"\")") 
  136.         cameraSafeTitleItem;
  137.  
  138.     string $ff = `camera -q -filmFit $current`;
  139.     menuItem -edit -radioButton ($ff == "fill") -en $isPerspective
  140.         -c ("camera -e -filmFit fill "+$current) 
  141.         cameraFillItem;
  142.     menuItem -edit -radioButton ($ff == "horizontal")
  143.         -en $isPerspective -c ("camera -e -filmFit horizontal "+$current)
  144.         cameraHorzItem;
  145.     menuItem -edit -radioButton ($ff == "vertical")
  146.         -en $isPerspective -c ("camera -e -filmFit vertical "+$current)
  147.         cameraVertItem;
  148.     menuItem -edit -radioButton ($ff == "overscan")
  149.         -en $isPerspective -c ("camera -e -filmFit overscan "+$current)
  150.         cameraOverscanItem;
  151. }
  152.